Project Overview :
● NumPy is an essential module for carrying out data science operations efficiently. NumPy stands for Numerical Python Importing, saving and processing of data takes up a major portion of the time in the field of Data Science.
● The numpy mean function or np.mean() is used for computing the arithmetic mean of the input values. Arithmetic mean is the sum of the elements along the axis divided by the number of elements.
Synatax: np.mean()
Minimum - min() : This function is used to compute the minimum of the values passed in its argument and lexicographically smallest value if strings are passed as arguments.
Maximum max() : This function is used to compute the maximum of the values passed in its argument and lexicographically largest value if strings are passed as arguments.
Requirements :
● Python
● VS code
● Library – numpy
Code :
import numpy as np Speed = [220,223,87,88,111,80,100,89,99,78,77,85,86] LENGTH=len(Speed) x = np.mean(Speed) print("Total Elements = ",LENGTH) print("MEAN OF THE SET = ",x) print('MINIMUM VALUE = ',min(Speed)) print('MAXIMUM VALUE = ',max(Speed))
Code Explanation :
● import numpy as np -- import numpy as np and use it in python. In command prompt or VS code terminal run the below pip command to install numpy library,
● pip3 install numpy # For Python version 3
● Speed = [220,223,87,88,111,80,100,89,99,78,77,85,86] ->get the random values/numbers in list/array format and stored in the variable called Speed.
● LENGTH=len(Speed) ->find the length of the list
● x = np.mean(Speed) ->find the mean value
● Then print all the values.
● print("Total Elements = ",LENGTH)
● print("MEAN OF THE SET = ",x)
● print('MINIMUM VALUE = ',min(Speed))
● print('MAXIMUM VALUE = ',max(Speed))
● Run the code.
Output :
●After running the code, output of the terminal as given below,